<?php

/**
 * BeamrPresentation form base class.
 *
 * @package    form
 * @subpackage beamr_presentation
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseBeamrPresentationForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'title'           => new sfWidgetFormInput(),
      'title_short'     => new sfWidgetFormInput(),
      'author'          => new sfWidgetFormInput(),
      'author_short'    => new sfWidgetFormInput(),
      'date'            => new sfWidgetFormInput(),
      'date_short'      => new sfWidgetFormInput(),
      'institute'       => new sfWidgetFormTextarea(),
      'institute_short' => new sfWidgetFormInput(),
      'theme'           => new sfWidgetFormDoctrineChoice(array('model' => 'BeamrThemes', 'add_empty' => false)),
      'colortheme'      => new sfWidgetFormDoctrineChoice(array('model' => 'BeamrColorThemes', 'add_empty' => false)),
      'is_public'       => new sfWidgetFormInputCheckbox(),
      'token'           => new sfWidgetFormInput(),
      'user_id'         => new sfWidgetFormDoctrineChoice(array('model' => 'sfGuardUser', 'add_empty' => true)),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorDoctrineChoice(array('model' => 'BeamrPresentation', 'column' => 'id', 'required' => false)),
      'title'           => new sfValidatorString(array('max_length' => 255)),
      'title_short'     => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'author'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'author_short'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'date'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'date_short'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'institute'       => new sfValidatorString(array('max_length' => 8000, 'required' => false)),
      'institute_short' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'theme'           => new sfValidatorDoctrineChoice(array('model' => 'BeamrThemes')),
      'colortheme'      => new sfValidatorDoctrineChoice(array('model' => 'BeamrColorThemes')),
      'is_public'       => new sfValidatorBoolean(),
      'token'           => new sfValidatorString(array('max_length' => 255)),
      'user_id'         => new sfValidatorDoctrineChoice(array('model' => 'sfGuardUser', 'required' => false)),
      'created_at'      => new sfValidatorDateTime(array('required' => false)),
      'updated_at'      => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'BeamrPresentation', 'column' => array('token')))
    );

    $this->widgetSchema->setNameFormat('beamr_presentation[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'BeamrPresentation';
  }

}